<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Promise.all 封装</title>
    <script src="./Promise.js"></script>
</head>
<body>
    <script>
        let p1 = new Promise((resolve,reject)=>{
            setTimeout(() =>{
                resolve('ok');
            },1000) 
        })
        let p2=Promise.resolve('success');
        let p3= Promise.resolve('yes');
        let p4= Promise.reject('error')

        // 成功 所有成功才成功
        const result1 = Promise.all([p1,p2,p3]);
        console.log(result1);
        // 失败 一个失败就失败
        const result2 = Promise.all([p1,p2,p3,p4]);
        console.log(result2);
    </script>
</body>
</html>